<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>房间表具列表</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	
	<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
	<script type="text/javascript" src="js/sharefunction.js"></script>
	
	<!-- grid.simple.min.css, grid.simple.min.js -->
    <link rel="stylesheet" href="js/grid/bsgrid.all.min.css"/>
    <script type="text/javascript" src="js/grid/grid.zh-CN.min.js"></script>
    <script type="text/javascript" src="js/grid/bsgrid.all.min.js"></script>
	<script type="text/javascript" src="js/layer/layer/layer.js"></script>
	
	<script type="text/javascript">
		var roomInfoId = "";
	  	$(document).ready(function() {
	  		//select2 下拉菜单
	  		roomInfoId = $("#roomInfoId").val();
		  	
		});
		
		function doAdd(){
			var url="room/roomWatch/form/"+roomInfoId;
			location.href = url;
		}
		
	</script>
  </head>
  
  <body>
  	
	<div id="content" style="padding-top:10px">
	 
	<!--查询框-->
	<div class="detail">
	
	 <div style="padding-bottom:15px;margin-top:5px">
		<div>
			<ul id="breadcrumb">
			  <li><a href="javascript:history.back()"><span class="icon icon-home"><img src="images/icons/64/home.png" width="32"/>  </span>返回</a></li>
			  <li><a href="javascript:void(0);" onclick="doAdd();return false"><span class="icon icon-home"><img src="images/icons/64/home.png" width="32"/>  </span>添加</a></li>
			</ul>
			
		</div>
		
		<div id="usual1" class="usual" style="margin-top:5px"> 
				
				<div id="tab1" class="tabson">
					<table id="searchTable" >
						<tr>
							<th w_index="roomInfoName" width="10%;" w_align="left">房间名称</th>
							<th w_index="watchName" width="10%;" w_align="left">表具名称</th>
							<th w_index="watchNo" width="10%;" w_align="left">编号</th>
							<th w_index="reading" width="12%;" w_align="left">最新读数</th>
							<th w_index="createTime" width="10%;" w_align="left">创建日期</th>
							<th w_index="opt" width="8%;" w_render="Data">操作</th>
							<th w_hidden="true" w_index="id" >id</th>
						</tr>
					</table>
					<script type="text/javascript">
						var gridObj;
						$(function () {
							gridObj = $.fn.bsgrid.init('searchTable', {
								url: "room/roomWatch/getJsonData",
								autoLoad: true,
								pageSizeSelect: true, 
								multiSort: true ,
								displayBlankRows: false ,
								pagingLittleToolbar: true,
								stripeRows: true,
								rowHoverColor: true,
								pageSize: 15,
								otherParames:{"roomInfoId":roomInfoId},
								curPage:1
							});
						});
						
						//操作
						function Data(record, rowIndex, colIndex, options) {
							var html="";;
							var id = gridObj.getRecordIndexValue(record, 'id');
							//html = "<a href=javascript:edit('"+id+"');>编辑</a>";
							html = "<a target='_blank' href='room/roomWatch/toedit/"+id+"'  >编辑</a>";
							
							html+=" &nbsp; &nbsp; <a href=javascript:doDel('"+id+"'); >删除</a>";
							return html;
						} 
						
						//删除
						function doDel(id){
							var url="room/roomWatch/del";
							layer.confirm("您确定删除吗？", {icon: 3}, function(index){
								jQuery.ajax({
							        type:"post",
							        async:false,
							        url:url,
							        data:{id:id},
							        success:function(data){
							            if(data.success){
							            		layer.alert(data.msg,{icon:6},function(i){
							            			layer.close(i);
							            			gridObj.refreshPage(); 
							            		});
							   	        }else{
							            	layer.alert(data.msg,{icon:7});
							            }
							        }
								})
							});
						}
					</script>
				</div>
			
		</div>
		
	</div>
	</div>
	</div>
	
	<div style="display:none">
		<input type="text" name="roomInfoId" id="roomInfoId" value="${roomInfoId }">
	</div>
	
  </body>
</html>

